package com.allwees.bs.module.mms.req.register;

import com.allwees.bs.core.modelbase.validate.ValidateItem;
import com.allwees.core.common.constant.EPlatform;
import com.allwees.core.common.util.encrypt.MD5Util;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = true)
public class RetailerRegisterResendNewEmailReq extends RetailerRegisterResendReq {

    private String email;

    @Override
    public ValidateItem[] getValidateItems() {
        return ArrayUtils.addAll(
                super.getValidateItems(),
                ValidateItem.of(StringUtils.isEmpty(email), "email 不能为空")
        );
    }

    @Override
    protected Object[] signValues() {
        return new Object[]{platform.name(), uuid, email, time.getTime()};
    }

    public static void main(String[] args) {
        RetailerRegisterResendNewEmailReq req = new RetailerRegisterResendNewEmailReq();
        req.setPlatform(EPlatform.PC);
        req.setUuid("3ffae03589dc46849657a4c407becbc1");
        req.setEmail("997940767@qq.com");

        req.setTime(new Date());
        String signText = StringUtils.join(req.signValues(), req.signSeparator());
        //f18086792681e3d5c059f01291bdb83c
        System.out.println(req.getTime().getTime());
        System.out.println(MD5Util.digest(signText));
    }
}
